#include "orangepch.h"
#include "Buffer.h"
#include "Renderer.h"

#include "Platform/OpenGl/OpenGLBuffer.h"
namespace Orange {
	VertexBuffer::~VertexBuffer()
	{
	}
	VertexBuffer* VertexBuffer::Create(uint32_t size)
	{

		switch (Renderer::GetAPI())
		{
		case RendererAPI::API::None: ORANGE_CORE_ASSERT(false, " RenderApi is not support! "); return nullptr;
		case RendererAPI::API::OpenGl: return new OpenGLVertexBuffer(size);
		}

		ORANGE_CORE_ASSERT(false, " RenderApi unknown! ")
			return nullptr;
	}
	VertexBuffer* VertexBuffer::Create(float* vertexs, uint32_t size)
	{

		switch (Renderer::GetAPI())
		{
		case RendererAPI::API::None: ORANGE_CORE_ASSERT(false, " RenderApi is not support! "); return nullptr;
		case RendererAPI::API::OpenGl: return new OpenGLVertexBuffer(vertexs, size);
		}

		ORANGE_CORE_ASSERT(false, " RenderApi unknown! ")
		return nullptr;
	}
	IndexBuffer::~IndexBuffer()
	{
	}
	IndexBuffer* IndexBuffer::Create(uint32_t* indexs, uint32_t count)
	{
		switch (Renderer::GetAPI())
		{
		case RendererAPI::API::None: ORANGE_CORE_ASSERT(false, " RenderApi is not support! "); return nullptr;
		case RendererAPI::API::OpenGl: return new OpenGLIndexBuffer(indexs, count);
		}

		ORANGE_CORE_ASSERT(false, " RenderApi unknown! ")
		return nullptr;
	}
}